﻿#region Using Statements
using GameBase.Screens;
using GameBase.Sprites;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace StarFox.ScreenComponents
{
    /// <summary>
    /// Messages associated to GamePlayScreen (pause).
    /// </summary>
    public class PauseMessage : ScreenComponent2D
    {
        #region Fields

        SpriteSheet spriteSheet;

        #endregion

        #region Screen Transitions

        /// <summary>
        /// Makes the component transition to visible state.
        /// </summary>
        public override void Show()
        {
        }

        /// <summary>
        /// Makes the component transition to hidden state.
        /// </summary>
        public override void Hide()
        {
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        /// <param name="screen">The Screen that this ScreenComponent2D is associated to.</param>
        public PauseMessage(Screen screen)
            : base(screen)
        {
            spriteSheet = Game.Content.Load<SpriteSheet>(ContentSettings.GetAsset("MSG_SPRITES"));
        }

        #endregion

        #region Update

        /// <summary>
        /// Called when the ScreenComponent2D needs to be updated.
        /// </summary>
        /// <param name="gameTime">Time elapsed since the last call to this method.</param>
        public override void Update(GameTime gameTime)
        {
        }

        #endregion

        #region Draw

        /// <summary>
        /// Called when the ScreenComponent2D needs to be drawn.
        /// </summary>
        /// <param name="gameTime">Time elapsed since the last call to this method.</param>
        public override void Draw(GameTime gameTime)
        {
            if (Screen.Paused)
            {
                Rectangle auxRect = spriteSheet.SourceRectangle("PAUSE");
                SpriteBatch.Draw(spriteSheet.Texture, new Vector2(Screen.Width * 0.5f, Screen.Height * 0.2f), auxRect, Color.Yellow,
                                 0.0f, new Vector2(auxRect.Width / 2, auxRect.Height / 2), Screen.Scale, SpriteEffects.None, 0);
            }
        }

        #endregion
    }
}
